import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/views/home.vue'
import News from '@/views/news.vue'
import Sports from '@/views/sports.vue'
import SportsHome from '@/views/second/sport_home.vue'
import SportsOut from '@/views/second/sport_out.vue'
import SportsIn from '@/views/second/sport_in.vue'
Vue.use(VueRouter)
//路由配置
const routes = [
  {
    //重定向
    path: '/',
    redirect: '/home',
  },
  {
    path: '/news',
    component: News,
  },
  {
    path: '/home',
    component: Home,
  },
  {
    path: '/sports',
    component: Sports,
    children: [
      {
        path: 'sports_home',
        component: SportsHome,
      },
      {
        path: 'sports_out',
        component: SportsOut,
      },
      {
        path: 'sports_in',
        component: SportsIn,
      },
      {
        //默认体育主页
        path: '',
        component: SportsHome,
      },
    ],
  },
]

const router = new VueRouter({
  routes,
})

export default router
